﻿//  --------------------------------
//  Copyright (c) 2010 Michael Schuler, Sascha Burger. All rights reserved.
//  This source code is made available under the terms of the Microsoft Public License (Ms-PL)
//  http://p2pmessaging.codeplex.com/license
//  ---------------------------------
using System;
using NUnit.Framework;
using p2pMessaging.BL;
using p2pMessaging.BL.Plugin;
using p2pMessaging.Contracts;
using p2pMessaging.Interfaces;

namespace p2pMessaging.Tests
{
	[TestFixture]
	public class PluginTest
	{
		private Guid myEmailId;
		private Guid myP2PId;
		
		[SetUp]
		public void setUp()
		{
			SerializeService serializeService = new SerializeService();
			myEmailId = new EmailMessageService().PluginId;
			myP2PId = new P2PMessageService(serializeService).PluginId;
		}
		
		[Test]
		public void FindEmail()
		{
			IMessageService emailService = ServiceLocator.GetPlugin(myEmailId);
			Assert.IsNotNull(emailService);
		}
		
		[Test]
		public void FindP2P()
		{
			IMessageService p2pService = ServiceLocator.GetPlugin(myP2PId);
			Assert.IsNotNull(p2pService);
		}
		
		[Test]
		public void FindNone()
		{
			IMessageService service = ServiceLocator.GetPlugin(Guid.Empty);
			Assert.IsNull(service);
		}
	}
}
